package com.example.hyw.szysteam.arithmetic;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * Created by HYW on 2018/6/11.
 */

public class Stacks {
    private LinkedList<Object> list=new LinkedList<>();
    public int top=-1;

    public void push(Object value){
        top++;
        list.addFirst(value);
    }

    public Object pop(){
        Object temp=list.getFirst();
        top--;
        list.removeFirst();
        return temp;
    }

    public Object top(){
        return list.getFirst();
    }

    public Iterator<Object> iterator(){
        Iterator<Object> iterator=list.iterator();
        return iterator;
    }
}
